const HOST = '/';

export default async (url, options) => {
  try {
    let res = await fetch(url, options);
    let {ok, data, err} = await res.json();
    if (ok) {
      return data;
    } else {
      throw err;
    }
  } catch (e) {
    throw e;
  }
};
